Skip to content

fix(core): preserve live HNSW identities across replacements and legacy restore - #1161

Closed
rudycelekli wants to merge 2 commits into
ruvnet:mainfrom
rudycelekli:fix/core-hnsw-live-replacements
Closed

rudycelekli wants to merge 2 commits into
ruvnet:mainfrom
rudycelekli:fix/core-hnsw-live-replacements

Conversation

@rudycelekli

@rudycelekli rudycelekli commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

Replacing an existing HNSW caller ID leaves its previous reverse mapping searchable. Queries can return duplicate live IDs with old and current scores, and deletion can leave an obsolete version visible. Invalidate obsolete reverse mappings for single/batch updates, canonicalize them when restoring older snapshots, and widen the bounded candidate search when historical physical rows crowd out live results.

This branch incorporates current main's FlatGraph implementation and its tuple-valued search API. It retains the existing graph design rather than restoring the former HNSW backend. Eight public Rust regressions cover live replacement, deletion, underfilled results, legacy snapshots, ordinary operations, and sparse deleted labels across restore and subsequent insertion. The legacy binary fixture was generated by original revision 07933730; the added sparse-label control specifically checks the current graph's distinction between dense positions and external labels.

Paired Linux qualification verifies the original PR head, current main 46d816ddc4c2a8a06cd3613534a79b1d557d858b, and the exact repaired Git tree before executing with Rust 1.98.1. Both trees use the same unchanged Cargo.lock; Cargo commands run with --locked --offline, and compiled gates have no external network or account credentials.

  • Current main fails six of the eight regressions and passes both controls; the repaired tree passes all eight. The baseline core test invocation stops at those same regression failures.
  • Repaired core build and complete ruvector-core --lib --tests pass: 508 passed, 5 ignored. Scoped core Clippy for all targets with -D warnings and workspace formatting also pass. These use the crate's default feature profile, not every optional feature.
  • Broad workspace all-feature Clippy, workspace tests, and benchmarks were attempted on both baseline and repair. All remain unqualified because yeslogic-fontconfig-sys could not find its system dependency; the overall qualification workflow therefore reports failure. This is not a whole-workspace pass.
  • Upstream Actions await maintainer approval. Fork validation does not replace upstream approval or CI.

Physical historical graph rows remain allocated. Replacement/deletion-heavy indexes can require wider candidate/ef searches, potentially approaching the allocated graph size. This preserves live identity without claiming exact nearest-neighbor search or graph compaction; the ADR records the tradeoff and snapshot provenance.

@proffesor-for-testing proffesor-for-testing left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed by Codex acting for Dragan, using GitHub account proffesor-for-testing. Exact reviewed head: 749e0e224d457eb92770b890d0d47cf780274768; compared with main 46d816ddc4c2a8a06cd3613534a79b1d557d858b.

No blocking defect found in the changed valid-index replacement/deletion and snapshot behavior. Reverse-map invalidation, last-write-wins batch handling, canonical legacy restore, sparse external labels, and lock-held search widening are consistent with the intended contract. The serialized layout is unchanged.

Independent Linux x86_64 / Rust 1.98.0 execution:

  • Separate baseline and candidate build directories: main fails six of the eight public regressions in each of three runs; the exact PR implementation passes all eight in each of three runs.
  • cargo test --locked --offline -p ruvector-core --lib --tests: 510 passed / 5 ignored in the local qualification tree, comprising the PR's existing tests plus two independently added tests. Those additions cover mixed mutation/restore against a live-row oracle for all four metrics and a 2,304-row duplicate batch crossing the parallel build boundaries. They are local qualification additions, not changes to this PR.
  • cargo clippy --locked --offline -p ruvector-core --all-targets -- -D warnings: passed. Formatting/diff checks passed.

Non-blocking notes: the ADR says seven regressions while the current file contains eight; search widening is bounded by historical next_idx, which can exceed physical node count after restore. The documented churn cost remains material. Malformed snapshot-map validation was not added or qualified here.

All six previously approval-gated upstream workflows for this exact head have now been approved through GitHub's normal run-approval API and are running/queued. Their results are still required; this code review is not a claim of green upstream CI, complete workspace/cross-platform qualification, publication readiness, or authorization to merge.

@proffesor-for-testing

proffesor-for-testing commented Oct 20, 2026 •

Copy link
Copy Markdown
Collaborator

Upstream CI follow-through at unchanged head 749e0e224d457eb92770b890d0d47cf780274768 (October 20 checkpoint):

All six contributor-gated runs were approved through GitHub's normal approval endpoint.

Passed:

Supply-chain fails RustSec and cargo-deny. Cargo audit reports 13 vulnerability instances: four rustls 0.23.45 advisories (RUSTSEC-2026-0346 through -0349), plus three ZIP extraction advisories (RUSTSEC-2026-0367 through -0369) across locked zip 1.1.4, 2.4.2, and 7.2.0. This PR changes neither Cargo.lock/Cargo.toml nor dependency policy/workflows; these are inherited from the current base dependency state, not introduced by the HNSW code diff. Existing proposals #1230 and #1231 remain draft/open and are not accepted repairs or waivers.

Workspace CI has passed its code guards, Clippy, Cargo check, vector-index and several other shards, but Security audit is red. The ml-research-heavy, core-and-rest-heavy, core-and-rest-wasm and core-and-rest groups are still running at this checkpoint; they have not been counted as passes.

GitHub's synthetic merge e6e3cd553331a153c988f28e51db086168eeebef has the same tree e39a41106094a3b68ebb91b2434aaec47758b996 as the reviewed head, so the merge checkout does not introduce a source-tree difference.

The scoped code approval above remains distinct from green CI, full release qualification, and authorization to merge. No gate was disabled, dependency-policy exception added, or merge performed by this session.

— Codex acting for Dragan (proffesor-for-testing)

@proffesor-for-testing

Copy link
Copy Markdown
Collaborator

Final upstream CI receipt for unchanged reviewed head 749e0e224d457eb92770b890d0d47cf780274768.

Workspace non-passing jobs:

The inherited dependency audit findings are documented in the earlier checkpoint and are not waived. Additional failed jobs above require diagnosis; they have not been assumed inherited. The scoped code review is not a green-CI or release/merge-readiness claim. No rerun, source mutation, advisory exception, merge or publication was performed by this watcher.

— Codex acting for Dragan (proffesor-for-testing); bounded exact-head CI watcher.

@proffesor-for-testing

Copy link
Copy Markdown
Collaborator

October21 qualification update at unchanged head749e0e224d457eb92770b890d0d47cf780274768, Codex acting for Dragan.

The quantization timing failure reproduces on unchanged main46d816ddc:1.329s against the one-second assertion. Under controlled CPU contention both main and this head fail3/3. Quantization source, test, build profiles and workflow are identical between revisions. This establishes a scheduling-sensitive inherited gate; it does not prove the exact GitHub cause or a production speed bound.

#1241 replaces that unoptimized stopwatch assertion with independent repeated numeric/Hamming oracles across eight SIMD boundaries and preserves the original512dimension workload in optimized Criterion benchmarks.36tests and scoped strictClippy pass; replacement passes3/3 under the same contention.

A local combined candidate containing this head, #1156, #1230/#1231 and our GNN/RVF drafts passes508core tests,5existing ignored. This is local integration evidence, not green upstream CI. Fresh RustSec scan now identifies three additional certificate advisories beyond the earlier13findings, so release dependency qualification is still open. No merge performed.

@proffesor-for-testing

Copy link
Copy Markdown
Collaborator

October 26 reconciliation with release candidate #1243, by Codex acting for Dragan.

Your exact head 749e0e224d457eb92770b890d0d47cf780274768 is now included by ancestry in candidate dd48830850a312fe21bf0175701ffc5584e54a9d, via merge 6edde5b42. This preserves the author history and current main/security changes. The original fork branch was not rewritten, and neither PR was merged to main.

This was a real source gap: predecessor candidate daae059dd failed six of your eight public regressions. Adding the independently reviewed mixed single/batch/delete/re-add/restore case yielded seven failures and two passing controls. The integrated candidate passes all nine, plus complete default-feature core lib/integration tests: 510 passed / 0 failed / 5 existing ignored on Rust 1.88. Scoped strict all-target Clippy passes on 1.98.1; workspace formatting passes.

Three added Python wheel regressions exercise HnswIndex → VectorDB → native index → metadata enrichment. All fail against the predecessor's actual installed wheel; all pass against the newly built, SHA-256-verified installed native binary. Full SDK with declared extras: 338 passed / 1 optional OpenAPI-validator dependency skip. These checks cover duplicate current IDs, stale distances paired with current metadata, deletion and live top-k underfill. The ADR now accurately states the nine-case coverage and the historical-next_idx termination bound; no graph-compaction/performance guarantee is added.

Fresh hosted qualification on the new candidate is pending. The review packet links exact new runs and separately records that the predecessor's full workspace completed all 18 jobs. Neither those predecessor passes nor the old checks on this fork head are transferred to the new source.

Frozen native0.1.3/companion0.2.0 recovery is recorded as incomplete/security-blocked; corrected0.1.5/0.2.1 is the successor delivery candidate. Original artifacts/audit failure remain unchanged, with no waiver. This operating disposition and source reconciliation authorize no main merge, tag or publication.

agent=Codex; human=Dragan; host=ruvultra; session=ruvector-1161-disposition-20261026.

@rudycelekli

Copy link
Copy Markdown
Contributor Author

Contents are in #1435, rebased on current main. Closing this PR so that stack gets one CI run and one review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants